package com.solidumgame.ninja.pot
{
	import com.pblabs.box2D.Box2DManagerComponent;
	import com.pblabs.box2D.Box2DSpatialComponent;
	import com.pblabs.box2D.PolygonCollisionShape;
	import com.pblabs.engine.PBE;
	import com.pblabs.engine.core.ObjectType;
	
	import flash.geom.Point;
	
	public class PotSpatialComponent extends Box2DSpatialComponent
	{
		private var _upperLimit:Number;
		
		
		public function getFloorLimit():Number{
			return this._upperLimit*this.spatialManager.inverseScale;
		}
		
		public function PotSpatialComponent()
		{
			super();
			// Create spatial component.
		    this.spatialManager = PBE.lookupEntity("SpatialManager").lookupComponentByName("Manager") as Box2DManagerComponent;
			this.position = new Point(-400, 400);
			this.size = new Point(400, 30);
			this.canMove = false;
			this.canRotate = false;
			this.collisionType = new ObjectType(Pot.TYPE);
			//this.collidesWithTypes = new ObjectType(Ingrdients.TYPE,"Hammer");

			
			this._upperLimit = 200 - this.size.y/2;
			
			// Collision shape.
			var shape:PolygonCollisionShape = new PolygonCollisionShape();
		    shape.vertices = [new Point(-1, -1), new Point(1, -1), new Point(1, 1), new Point(-1, 1)];
			shape.density = 1;
			shape.friction = 100;
			// Add the shape to spatial component.
			this.collisionShapes = new Array();
			this.collisionShapes.push(shape);
		}

		public function get upperLimit():Number
		{
			return _upperLimit;
		}

		public function set upperLimit(value:Number):void
		{
			
		}

	}
}